//
//  AppConstants.h
//  AppsTemplate
//  项目静态常量配置
//  Created by Maple on 8/1/14.
//  Copyright (c) 2014 Maple. All rights reserved.
//

#ifndef AppsTemplate_AppConstants_h
#define AppsTemplate_AppConstants_h

#ifdef DEBUG
#   define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#   define OutputLog(fmt, ...) NSLog(fmt, ##__VA_ARGS__);
#else
#   define DLog(...)
#   define OutputLog(...)
#endif

#define ERROR_MSG @"ERROR_MSG"
#define User_Name @"User_Name"
#define User_Pass @"User_Pass"
// 网络请求超时的时间长度
#define TIME_OUT_LIMITED  15.0f
// navigaitonBar高度
#define KNAVIGATIONBAR_HEIGHT 44.0f
// navigaitonBar背景图片名称
#define KNAVIGATIONBAR_BG @"navBar_bg.png"
// ios7环境下navigaitonBar高度
#define KNAVIGATIONBAR_BG_7 @"navBar_bg_7.png"
//navigationBar返回按钮名称
#define KNAVIGATION_RETURN_BG @"return_btn"
#define KNAVIGATION_RETURN_H_BG @"return_h_btn"

#define EventTitlesViewH 40

// block self
#define WEAKSELF typeof(self) __weak weakSelf = self;

#define STRONGSELF typeof(weakSelf) __strong strongSelf = weakSelf;

//屏蔽log
#ifndef __OPTIMIZE__
#define NSLog(...) NSLog(__VA_ARGS__)
#else
#define NSLog(...) {}
#endif

//TabBar背景图片
#define KTABBAR_BG @"tabBar_bg.png"


// 主页底部view高度
#define KMAINBOTTON_VIEW_HEIGHT 49.0f


// 是否是iPhone5屏幕
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

// RGB颜色
#define SHColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

#define MAIN_Color SHColor(255,251,240)

#pragma mark - 颜色
#define kWhiteColor      [UIColor whiteColor]
#define kBlackColor      [UIColor blackColor]
#define kDarkGrayColor   [UIColor darkGrayColor]
#define kLightGrayColor  [UIColor lightGrayColor]
#define kGrayColor       [UIColor grayColor]
#define kRedColor        [UIColor redColor]
#define kGreenColor      [UIColor greenColor]
#define kBlueColor       [UIColor blueColor]
#define kCyanColor       [UIColor cyanColor]
#define kYellowColor     [UIColor yellowColor]
#define kMagentaColor    [UIColor magentaColor]
#define kOrangeColor     [UIColor orangeColor]
#define kPurpleColor     [UIColor purpleColor]
#define kBrownColor      [UIColor brownColor]
#define kClearColor      [UIColor clearColor]

// App 宽高
#define BCAPP_WIDTH   [UIScreen mainScreen].bounds.size.width
#define BCAPP_HEIGHT  [UIScreen mainScreen].bounds.size.height

#define kCommonGrayTextColor [UIColor colorWithRed:0.63f green:0.63f blue:0.63f alpha:1.00f]
#define kTextColor [UIColor colorWithRed:0.32f green:0.36f blue:0.40f alpha:1.00f]
#define kROLightFrayTextColor [UIColor colorWithRed:(100.0/ 255) green:(100.0/ 255) blue:(100.0/ 255) alpha:1.00f]
#define kSeparateColor [UIColor colorWithRed:240.0 / 255 green:240.0 / 255 blue:240.0 / 255 alpha:1]
#define kDetailBackGroudColor [UIColor colorWithRed:100.0 / 255 green:100.0 / 255 blue:100.0 / 255 alpha:1]
#define kClearColor [UIColor clearColor]
#define kTableViewBackGroudColor [UIColor colorWithRed:245.0 / 255 green:245.0 / 255 blue:245.0 / 255 alpha:1]
#define kViewBackGroundColor     [UIColor colorWithRed:246.0 / 255 green:246.0 / 255 blue:246.0 / 255 alpha:1]
#define kTableViewCellTextColor  [UIColor colorWithRed:85.0  / 255 green: 85.0 / 255 blue: 85.0 / 255 alpha:1]
#define kClearColor [UIColor clearColor]
#define KTitleTextColor [UIColor blackColor]
#define kClassifyVCColor [UIColor colorWithRed:200.0 / 255 green:200.0 / 255 blue:200.0 / 255 alpha:1]
#define kEvetnCellGrayTextColor [UIColor colorWithRed:(168.0/ 255) green:(168.0/ 255) blue:(168.0/ 255) alpha:1.00f]
#define kCommonBgColor [UIColor colorWithRed:0.86f green:0.85f blue:0.80f alpha:1.00f]
// 字体
#define KTitleTextFont [UIFont systemFontOfSize:15];    //标题字体
#define kShowContentTextFont  [UIFont systemFontOfSize:13];//显示内容的字体
/***  普通字体 */
#define kFont(size) [UIFont systemFontOfSize:size]
/***  粗体 */
#define kBoldFont(size) [UIFont boldSystemFontOfSize:size]






#define kTipAlert(_S_, ...)     [[[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:(_S_), ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"好的" otherButtonTitles:nil] show]


#define MenuBarButtonItem(methodAction,imageName) \
UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom];\
[leftButton setFrame:CGRectMake(0, 0,22, 22)];\
[leftButton setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];\
[leftButton addTarget:self action:(methodAction) forControlEvents:UIControlEventTouchUpInside];\
UIBarButtonItem * leftButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftButton];\
self.navigationItem.leftBarButtonItem = leftButtonItem;

// 通用的时间格式样式
#define TIME_STRING_TEMPLATE @"yyyy-MM-dd HH:mm:ss"
// 判断系统是否为iOS7以上
#define IOS7_OR_LATER ([[[UIDevice currentDevice] systemVersion] intValue] >= 7.0f?YES:NO)
// 判断系统是否为iOS8以上   (消息推送在ios8要做修改)
#define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
//成功分享应用信息
#define NSNOTIFICATION_SHARE_APP_INFO_SUCCESS @"NSNOTIFICATION_SHARE_APP_INFO_SUCCESS"

//用户登陆成功
#define NSNOTIFICATION_USER_LOGIN_SUCCESS @"NSNOTIFICATION_USER_LOGIN_SUCCESS"

//用户注销成功
#define NSNOTIFICATION_USER_LOGOUT_SUCCESS @"NSNOTIFICATION_USER_LOGOUT_SUCCESS"


#define RightButtonItem(methodAction,imageName) \
UIButton * rightButton = [UIButton buttonWithType:UIButtonTypeCustom];\
[rightButton setFrame:CGRectMake(0, 0,44,44)];\
[rightButton setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];\
[rightButton addTarget:self action:(methodAction) forControlEvents:UIControlEventTouchUpInside];\
UIBarButtonItem * rightButtonItem = [[UIBarButtonItem alloc]initWithCustomView:rightButton];\
UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];\
if (IOS7_OR_LATER) {\
negativeSpacer.width = -20;\
} else {\
negativeSpacer.width = 0;\
}\
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:negativeSpacer,rightButtonItem,nil]];



#define RightButtonItem1(methodAction,title) \
UIButton * rightButton = [UIButton buttonWithType:UIButtonTypeCustom];\
[rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];\
[rightButton setFrame:CGRectMake(0, 0,50, 44)];\
rightButton.titleLabel.font = [UIFont systemFontOfSize:14.0f];\
[rightButton setTitle:title forState:UIControlStateNormal];\
[rightButton addTarget:self action:(methodAction) forControlEvents:UIControlEventTouchUpInside];\
UIBarButtonItem * rightButtonItem = [[UIBarButtonItem alloc]initWithCustomView:rightButton];\
UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];\
if (IOS7_OR_LATER) {\
negativeSpacer.width = -20;\
} else {\
negativeSpacer.width = 0;\
}\
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:negativeSpacer,rightButtonItem,nil]];


#define RightButtonItemView(view) \
UIBarButtonItem * rightButtonItem = [[UIBarButtonItem alloc]initWithCustomView:view];\
UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];\
if (IOS7_OR_LATER) {\
negativeSpacer.width = -20;\
} else {\
negativeSpacer.width = 0;\
}\
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:negativeSpacer,rightButtonItem,nil]];

#define LeftButtonItemView(view) \
UIBarButtonItem * leftButtonItem = [[UIBarButtonItem alloc]initWithCustomView:view];\
self.navigationItem.leftBarButtonItem = leftButtonItem;

#define LeftButtonItem(methodAction,imageName) \
UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom];\
[leftButton setFrame:CGRectMake(0, 0,44,44)];\
[leftButton setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];\
[leftButton addTarget:self action:(methodAction) forControlEvents:UIControlEventTouchUpInside];\
UIBarButtonItem * leftButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftButton];\
UIBarButtonItem *negativeSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];\
if (IOS7_OR_LATER) {\
negativeSpace.width = -20;\
} else {\
negativeSpace.width = 0;\
}\
[self.navigationItem setLeftBarButtonItems:[NSArray arrayWithObjects:negativeSpace,leftButtonItem,nil]];\

#define NavBarTitle(title)\
CGRect rect = CGRectMake(0, 0, 140, 44);\
UILabel *titleLabel = [[UILabel alloc] initWithFrame:rect];\
titleLabel.textAlignment = NSTextAlignmentCenter;\
titleLabel.font = [UIFont systemFontOfSize:17];\
titleLabel.textColor =MAIN_Color;\
titleLabel.backgroundColor = [UIColor clearColor];\
titleLabel.text = (title);\
self.navigationItem.titleView = titleLabel;



#endif
//
//  AppConstants.h
//  AppsTemplate
//  项目静态常量配置
//  Created by Maple on 8/1/14.
//  Copyright (c) 2014 Maple. All rights reserved.
//

#ifndef AppsTemplate_AppConstants_h
#define AppsTemplate_AppConstants_h

#ifdef DEBUG
#   define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#   define OutputLog(fmt, ...) NSLog(fmt, ##__VA_ARGS__);
#else
#   define DLog(...)
#   define OutputLog(...)
#endif

#define ERROR_MSG @"ERROR_MSG"
#define User_Name @"User_Name"
#define User_Pass @"User_Pass"
// 网络请求超时的时间长度
#define TIME_OUT_LIMITED  15.0f
// navigaitonBar高度
#define KNAVIGATIONBAR_HEIGHT 44.0f
// navigaitonBar背景图片名称
#define KNAVIGATIONBAR_BG @"navBar_bg.png"
// ios7环境下navigaitonBar高度
#define KNAVIGATIONBAR_BG_7 @"navBar_bg_7.png"
//navigationBar返回按钮名称
#define KNAVIGATION_RETURN_BG @"return_btn"
#define KNAVIGATION_RETURN_H_BG @"return_h_btn"

#define EventTitlesViewH 40

// block self
#define WEAKSELF typeof(self) __weak weakSelf = self;

#define STRONGSELF typeof(weakSelf) __strong strongSelf = weakSelf;

//屏蔽log
#ifndef __OPTIMIZE__
#define NSLog(...) NSLog(__VA_ARGS__)
#else
#define NSLog(...) {}
#endif

//TabBar背景图片
#define KTABBAR_BG @"tabBar_bg.png"


// 主页底部view高度
#define KMAINBOTTON_VIEW_HEIGHT 49.0f


// 是否是iPhone5屏幕
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

// RGB颜色
#define SHColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

#define MAIN_Color SHColor(255,251,240)

// App 宽高
#define BCAPP_WIDTH   [UIScreen mainScreen].bounds.size.width
#define BCAPP_HEIGHT  [UIScreen mainScreen].bounds.size.height

#define kCommonGrayTextColor [UIColor colorWithRed:0.63f green:0.63f blue:0.63f alpha:1.00f]
#define kTextColor [UIColor colorWithRed:0.32f green:0.36f blue:0.40f alpha:1.00f]
#define kROLightFrayTextColor [UIColor colorWithRed:(100.0/ 255) green:(100.0/ 255) blue:(100.0/ 255) alpha:1.00f]
#define kSeparateColor [UIColor colorWithRed:240.0 / 255 green:240.0 / 255 blue:240.0 / 255 alpha:1]
#define kDetailBackGroudColor [UIColor colorWithRed:100.0 / 255 green:100.0 / 255 blue:100.0 / 255 alpha:1]
#define kClearColor [UIColor clearColor]
#define kTableViewBackGroudColor [UIColor colorWithRed:245.0 / 255 green:245.0 / 255 blue:245.0 / 255 alpha:1]
#define kViewBackGroundColor     [UIColor colorWithRed:246.0 / 255 green:246.0 / 255 blue:246.0 / 255 alpha:1]
#define kTableViewCellTextColor  [UIColor colorWithRed:85.0  / 255 green: 85.0 / 255 blue: 85.0 / 255 alpha:1]
#define kClearColor [UIColor clearColor]
#define KTitleTextColor [UIColor blackColor]
#define kClassifyVCColor [UIColor colorWithRed:200.0 / 255 green:200.0 / 255 blue:200.0 / 255 alpha:1]
#define kEvetnCellGrayTextColor [UIColor colorWithRed:(168.0/ 255) green:(168.0/ 255) blue:(168.0/ 255) alpha:1.00f]
// 字体
#define KTitleTextFont [UIFont systemFontOfSize:15];    //标题字体
#define kShowContentTextFont  [UIFont systemFontOfSize:13];//显示内容的字体






#define kTipAlert(_S_, ...)     [[[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:(_S_), ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"好的" otherButtonTitles:nil] show]


#define MenuBarButtonItem(methodAction,imageName) \
UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom];\
[leftButton setFrame:CGRectMake(0, 0,22, 22)];\
[leftButton setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];\
[leftButton addTarget:self action:(methodAction) forControlEvents:UIControlEventTouchUpInside];\
UIBarButtonItem * leftButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftButton];\
self.navigationItem.leftBarButtonItem = leftButtonItem;

// 通用的时间格式样式
#define TIME_STRING_TEMPLATE @"yyyy-MM-dd HH:mm:ss"
// 判断系统是否为iOS7以上
#define IOS7_OR_LATER ([[[UIDevice currentDevice] systemVersion] intValue] >= 7.0f?YES:NO)
// 判断系统是否为iOS8以上   (消息推送在ios8要做修改)
#define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
//成功分享应用信息
#define NSNOTIFICATION_SHARE_APP_INFO_SUCCESS @"NSNOTIFICATION_SHARE_APP_INFO_SUCCESS"

//用户登陆成功
#define NSNOTIFICATION_USER_LOGIN_SUCCESS @"NSNOTIFICATION_USER_LOGIN_SUCCESS"

//用户注销成功
#define NSNOTIFICATION_USER_LOGOUT_SUCCESS @"NSNOTIFICATION_USER_LOGOUT_SUCCESS"


#define RightButtonItem(methodAction,imageName) \
UIButton * rightButton = [UIButton buttonWithType:UIButtonTypeCustom];\
[rightButton setFrame:CGRectMake(0, 0,44,44)];\
[rightButton setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];\
[rightButton addTarget:self action:(methodAction) forControlEvents:UIControlEventTouchUpInside];\
UIBarButtonItem * rightButtonItem = [[UIBarButtonItem alloc]initWithCustomView:rightButton];\
UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];\
if (IOS7_OR_LATER) {\
negativeSpacer.width = -20;\
} else {\
negativeSpacer.width = 0;\
}\
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:negativeSpacer,rightButtonItem,nil]];



#define RightButtonItem1(methodAction,title) \
UIButton * rightButton = [UIButton buttonWithType:UIButtonTypeCustom];\
[rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];\
[rightButton setFrame:CGRectMake(0, 0,50, 44)];\
rightButton.titleLabel.font = [UIFont systemFontOfSize:14.0f];\
[rightButton setTitle:title forState:UIControlStateNormal];\
[rightButton addTarget:self action:(methodAction) forControlEvents:UIControlEventTouchUpInside];\
UIBarButtonItem * rightButtonItem = [[UIBarButtonItem alloc]initWithCustomView:rightButton];\
UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];\
if (IOS7_OR_LATER) {\
negativeSpacer.width = -20;\
} else {\
negativeSpacer.width = 0;\
}\
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:negativeSpacer,rightButtonItem,nil]];


#define RightButtonItemView(view) \
UIBarButtonItem * rightButtonItem = [[UIBarButtonItem alloc]initWithCustomView:view];\
UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];\
if (IOS7_OR_LATER) {\
negativeSpacer.width = -20;\
} else {\
negativeSpacer.width = 0;\
}\
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:negativeSpacer,rightButtonItem,nil]];

#define LeftButtonItemView(view) \
UIBarButtonItem * leftButtonItem = [[UIBarButtonItem alloc]initWithCustomView:view];\
self.navigationItem.leftBarButtonItem = leftButtonItem;

#define LeftButtonItem(methodAction,imageName) \
UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom];\
[leftButton setFrame:CGRectMake(0, 0,44,44)];\
[leftButton setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];\
[leftButton addTarget:self action:(methodAction) forControlEvents:UIControlEventTouchUpInside];\
UIBarButtonItem * leftButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftButton];\
UIBarButtonItem *negativeSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];\
if (IOS7_OR_LATER) {\
negativeSpace.width = -20;\
} else {\
negativeSpace.width = 0;\
}\
[self.navigationItem setLeftBarButtonItems:[NSArray arrayWithObjects:negativeSpace,leftButtonItem,nil]];\

#define NavBarTitle(title)\
CGRect rect = CGRectMake(0, 0, 140, 44);\
UILabel *titleLabel = [[UILabel alloc] initWithFrame:rect];\
titleLabel.textAlignment = NSTextAlignmentCenter;\
titleLabel.font = [UIFont systemFontOfSize:17];\
titleLabel.textColor =MAIN_Color;\
titleLabel.backgroundColor = [UIColor clearColor];\
titleLabel.text = (title);\
self.navigationItem.titleView = titleLabel;



#endif
